<script>
import apiEmp from "@/pages/v1/mes/Emp/js/apiEmp";
import EzBarCode from "@/comps/comm/EzBarCode.vue";

export default {
  components: {EzBarCode},
  data() {
    return {
      title: '打印',
      id:0,
      info:{},
      ready:false
    }
  },
  mounted() {
    this.id = this.$route.query.id * 1
    this.getInfo()
  },
  methods:{
    getInfo(){
      apiEmp.find(this.id,res=>{
        console.log(res)
        this.info = res.data
        this.ready = true
      })
    }
  }
}
</script>

<template>
<div>
  <div id="userInfo" class="flcc" v-if="ready">
    <EzBarCode style="width: 150px;" :code="info.card"></EzBarCode>
    <div>{{info.name}}</div>
  </div>

  <div class="pad10 tac">
    <mu-button ref="printBtn" color="primary" v-print="'#userInfo'" flat>
      <mu-icon left value="print"></mu-icon>
      打印
    </mu-button>
    <mu-button color="primary"  @click="goback(-1)" flat>
      <mu-icon left value="exit_to_app"></mu-icon>
      返回
    </mu-button>
  </div>
</div>
</template>

<style scoped>

</style>